//SPL 2010 
//Assignment 2
//MarketReport.h
//Last change 08/12/09

//DO NOT CHANGE THIS FILE!

#ifndef StockReport_H
#define StockReport_H

#include "CommonDef.h"

#include "Poco/DateTime.h"

#include <string>
#include <vector>
#include <sstream>

using namespace ass2;
/*
 * Class CMarketReport generates the reports event for assignment 2. 
 * The structure and enum were defined in commonDef.h file.
 * The user is responsble to allocate and relese the memory.
 * note that some functions use reference and other pointer.
 * all report return true if the report execute.
 */

class CMarketReport
{
public:

 	//constructor
	CMarketReport(void);

	//constructor parameters: configFile and eventFile - the files' name 
	//firstId and secondId - your id (for grading the assignment).
	CMarketReport(const std::string & configFile, const std::string & eventFile,
					int firstId, int secondId);
	
	
	virtual ~CMarketReport(void);
    

    //Reports user status. Use time parameter as a string (day/month/year)
	bool reportUser(int id, const std::string & name, 
		const unitContainer & energyUnits, const std::string & stime) const;

	//Reports user status. Use time parameter as a DateTime
	bool reportUser(int id, const std::string & name, 
		const unitContainer & energyUnits, const Poco::DateTime & time) const;


	//Reports energy value. Use time parameter as a string (day/month/year)
	bool reportEnergy(valueContainer * energyValue, const std::string & stime) const;

	//Reports energy value. Use time parameter as a DateTime
	bool reportEnergy(valueContainer * energyValue, const Poco::DateTime & time) const;


	//Reports profit of a user. Use time parameter as a string (day/month/year)
	bool reportProfit(int id, const std::string & name, double profit, const std::string & stime) const;

	//Reports profit of a user. Use time parameter as a DateTime
	bool reportProfit(int id, const std::string & name, double profit, const Poco::DateTime & time) const;


    //Reports activity status. Use time parameter as a string (day/month/year)
	bool reportActivity(const std::string & name, const unitContainer & produced, 
		const unitContainer & consumed, const std::string & stime) const;

	//Reports activity status. Use time parameter as a DateTime
	bool reportActivity(const std::string & name, const unitContainer & produced, 
		const unitContainer & consumed, const Poco::DateTime & time) const;


	//Reports account details. Use time parameter as a string (day/month/year)
	bool reportAccount(int userId, const std::string & userName, double amount, 
		const std::string & stime) const;

	//Reports account details. Use time parameter as a DateTime
	bool reportAccount(int userId, const std::string & userName, double amount, 
		const Poco::DateTime & time) const;


private:
	//members
	std::string mConfigFile;
	std::string mEventFile;
	int mFirstId;
	int mSecondId;
	bool mTest;

	void printUnits(unitContainer units) const;
	void printValues(valueContainer values) const;
	std::string toStr(Poco::DateTime time) const;

 
};



#endif
